from rest_framework import serializers

from .models import *


class RankSerializer(serializers.ModelSerializer):
    class Meta:
        model = Rank
        fields = ('id', 'name', 'fraction')


class AdditionalSerializer(serializers.ModelSerializer):
    additional_rank = RankSerializer(many=True)

    class Meta:
        model = Additional
        fields = ('id', 'name', 'fraction', 'type', 'nature', 'additional_rank')


class ScholarshipSerializer(serializers.ModelSerializer):
    scholarship_additional = AdditionalSerializer(many=True)

    class Meta:
        model = Scholarship
        fields = ('id', 'name', 'scholarship_additional')


class SubmitRecordsSerializer(serializers.ModelSerializer):
    class Meta:
        model = SubmitRecords
        fields = "__all__"
        depth = 1